import java.awt.event.KeyEvent;


public class ThreadMove extends Thread{
	
	private MoveFrame frame;
	private int mouv = 20;
	KeyEvent e;
	
	public ThreadMove (KeyEvent e, MoveFrame frame){
		this.frame = frame;
		this.e = e;
		
	}
	
	public void run(){
		while(1 > 0){
			switch(e.getKeyCode()){
			case KeyEvent.VK_RIGHT:
				frame.deplacer(frame.X + mouv, frame.Y);
				break;
			case KeyEvent.VK_LEFT:
				frame.deplacer(frame.X - mouv, frame.Y);
				break;
			case KeyEvent.VK_UP:
				frame.deplacer(frame.X , frame.Y - mouv);
				break;
			case KeyEvent.VK_DOWN:
				frame.deplacer(frame.X, frame.Y + mouv);
				break;
			}
			try {
				this.sleep(40);
			} catch (InterruptedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}
	}

}
